from datetime import datetime

from pydantic import BaseModel

class BaseSchema(BaseModel):
    class Config:
        from_attributes = True

class UserCreate(BaseModel):
    username: str
    email: str
    role_id: int

class UserUpdate(BaseModel):
    username: str | None = None
    email: str | None = None
    is_active: bool | None = None

class UserOut(BaseSchema):
    id: int
    username: str
    email: str
    is_active: bool
    role_name: str

class CourseCreate(BaseModel):
    name: str
    description: str

class CourseUpdate(BaseModel):
    name: str
    description: str

class CourseOut(BaseSchema):
    id: int
    name: str
    description: str
    created_at: datetime
    updated_at: datetime